// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   BasicArchive.java

package com.oa.hr;

import com.oa.database.DataConn;
import com.oa.database.QueryData;
import com.oa.util.Format;
import java.io.PrintStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;

// Referenced classes of package com.oa.hr:
//            BasicArchiveInfor

public class BasicArchive
{

    private DataConn dataConn;
    private QueryData queryData;
    private Format format;
    private ResultSet rs;
    private BasicArchiveInfor basicArchiveInfor;
    private ArrayList salaryFieldList;
    private String sTable;
    private String sField;
    private String sCond;
    private String sql;

    public BasicArchive()
    {
        dataConn = null;
        queryData = null;
        format = null;
        rs = null;
        basicArchiveInfor = null;
        salaryFieldList = new ArrayList();
        sTable = "";
        sField = "";
        sCond = "";
        sql = "";
    }

    public BasicArchive(DataConn dataConnection)
    {
        dataConn = null;
        queryData = null;
        format = null;
        rs = null;
        basicArchiveInfor = null;
        salaryFieldList = new ArrayList();
        sTable = "";
        sField = "";
        sCond = "";
        sql = "";
        dataConn = dataConnection;
        queryData = new QueryData(dataConn);
    }

    public ArrayList getBasicArchiveList()
    {
        return salaryFieldList;
    }

    public BasicArchiveInfor getBasicArchiveInfor(int id)
        throws SQLException
    {
        try
        {
            sTable = "OA_YG_JB AS A,OA_BMB AS B";
            sField = "A.JBXXID,A.YGXM,A.YGBM,B.BMMC";
            sCond = "A.YGBM=B.BMID AND A.JBXXID=" + id;
            queryData.setMultRecordSet(sTable, sField, sCond);
            rs = queryData.getResultSet();
            if(rs.next())
            {
                basicArchiveInfor = new BasicArchiveInfor();
                basicArchiveInfor.setBXXID(rs.getInt("JBXXID"));
                basicArchiveInfor.setYGXM(rs.getString("YGXM"));
                basicArchiveInfor.setYGBM(rs.getInt("YGBM"));
                basicArchiveInfor.setBMMC(rs.getString("BMMC"));
            }
            rs.close();
        }
        catch(SQLException e)
        {
            System.out.println(e.getMessage());
            throw e;
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
        return basicArchiveInfor;
    }

    public Collection getList(String sCondition)
        throws SQLException
    {
        try
        {
            sTable = "OA_YG_JB AS A,OA_BMB AS B";
            sField = "A.JBXXID,A.YGXM,A.YGBM,B.BMMC";
            sCond = "A.YGBM=B.BMID AND " + sCondition;
            queryData.setMultRecordSet(sTable, sField, sCond);
            for(rs = queryData.getResultSet(); rs.next(); salaryFieldList.add(basicArchiveInfor))
            {
                basicArchiveInfor = new BasicArchiveInfor();
                basicArchiveInfor.setBXXID(rs.getInt("JBXXID"));
                basicArchiveInfor.setYGXM(rs.getString("YGXM"));
                basicArchiveInfor.setYGBM(rs.getInt("YGBM"));
                basicArchiveInfor.setBMMC(rs.getString("BMMC"));
            }

            rs.close();
        }
        catch(SQLException e)
        {
            System.out.println(e.getMessage());
            throw e;
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
        return salaryFieldList;
    }

    public static void main(String args[])
    {
        BasicArchive basicArchive1 = new BasicArchive();
    }
}
